﻿using Song.Common.Tools;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;

namespace Test.Unit
{
    
    
    /// <summary>
    ///This is a test class for GenericExtensionsTest and is intended
    ///to contain all GenericExtensionsTest Unit Tests
    ///</summary>
    [TestClass()]
    public class GenericExtensionsTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Aggregate
        ///</summary>
        public void AggregateTestHelper<TSource>()
        {
            IEnumerable<TSource> source = null; // TODO: Initialize to an appropriate value
            Func<TSource, TSource, int, TSource> func = null; // TODO: Initialize to an appropriate value
            TSource expected = default(TSource); // TODO: Initialize to an appropriate value
            TSource actual;
            actual = GenericExtensions.Aggregate<TSource>(source, func);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void AggregateTest()
        {
            AggregateTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for Do
        ///</summary>
        public void DoTestHelper<T>()
        {
            T t = default(T); // TODO: Initialize to an appropriate value
            Action<T> action = null; // TODO: Initialize to an appropriate value
            T expected = default(T); // TODO: Initialize to an appropriate value
            T actual;
            //actual = GenericExtensions.Do<T>(t,action(t));
            //Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void DoTest()
        {
            DoTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for If
        ///</summary>
        public void IfTestHelper<T>()
            where T : class
        {
            T t = null; // TODO: Initialize to an appropriate value
            Predicate<T> predicate = null; // TODO: Initialize to an appropriate value
            Action<T>[] actions = null; // TODO: Initialize to an appropriate value
            T expected = null; // TODO: Initialize to an appropriate value
            T actual;
            actual = GenericExtensions.If<T>(t, predicate, actions);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void IfTest()
        {
            IfTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for In
        ///</summary>
        public void InTestHelper<T>()
        {
            T t = default(T); // TODO: Initialize to an appropriate value
            T[] c = null; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = GenericExtensions.In<T>(t, c);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void InTest()
        {
            InTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///A test for IsBetween
        ///</summary>
        public void IsBetweenTestHelper<T>()
            where T : class , IComparable<T>
        {
            T t = null; // TODO: Initialize to an appropriate value
            T lowerBound = null; // TODO: Initialize to an appropriate value
            T upperBound = null; // TODO: Initialize to an appropriate value
            bool includeLowerBound = false; // TODO: Initialize to an appropriate value
            bool includeUpperBound = false; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = GenericExtensions.IsBetween<T>(t, lowerBound, upperBound, includeLowerBound, includeUpperBound);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        [TestMethod()]
        public void IsBetweenTest()
        {
            Assert.Inconclusive("No appropriate type parameter is found to satisfies the type constraint(s) of T. " +
                    "Please call IsBetweenTestHelper<T>() with appropriate type parameters.");
        }

        /// <summary>
        ///A test for While
        ///</summary>
        public void WhileTestHelper<T>()
            where T : class
        {
            T t = null; // TODO: Initialize to an appropriate value
            Predicate<T> predicate = null; // TODO: Initialize to an appropriate value
            Action<T>[] actions = null; // TODO: Initialize to an appropriate value
            GenericExtensions.While<T>(t, predicate, actions);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        [TestMethod()]
        public void WhileTest()
        {
            WhileTestHelper<GenericParameterHelper>();
        }
    }
}
